using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class WaybillExceptionLogMap : EntityTypeConfiguration<WaybillExceptionLog>
	{
		public WaybillExceptionLogMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			this.Property(t => t.Operater)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.IP)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.LogType)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.Remark)
				.IsRequired()
				.HasMaxLength(1000);
				
			// Table & Column Mappings
			this.ToTable("WaybillExceptionLog");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.ExceptionOrderFormId).HasColumnName("ExceptionOrderFormId");
			this.Property(t => t.WaybillNo).HasColumnName("WaybillNo");
			this.Property(t => t.Operater).HasColumnName("Operater");
			this.Property(t => t.LogTime).HasColumnName("LogTime");
			this.Property(t => t.IP).HasColumnName("IP");
			this.Property(t => t.LogType).HasColumnName("LogType");
			this.Property(t => t.Remark).HasColumnName("Remark");
		}
	}
}

